﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;

namespace Disk
{
    public partial class changecode : Form
    {
        public changecode()
        {
            InitializeComponent();
        }

        public static login login = new login();
        public static firstpage firstpage = new firstpage();

        private void Rebutton_Click(object sender, EventArgs e)
        {
            this.pictureBox2.Image = Properties.Resources.bili2;
            if (IdBox.Text != "")
            {
                //原始密码要与服务器判断是否相符
                if (PassBox.Text != "")
                {
                    //判断新密码是否与原始密码相同
                    if (RePassBox.Text != "")
                    {
                        if (PassBox.Text != RePassBox.Text)
                        {
                            if (RePassBox1.Text != "")
                            {
                                if (RePassBox.Text == RePassBox1.Text)
                                {
                                    MessageBox.Show("修改成功，进入登录界面", "修改提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
                                    //显示登录窗体，隐藏注册窗体
                                    login.Show();
                                    this.Hide();
                                    firstpage.Hide();
                                }
                                else if (RePassBox.Text != PassBox.Text)
                                {
                                    MessageBox.Show("请重新确认密码", "注册提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
                                }
                            }
                            else if (RePassBox1.Text == "")
                            {
                                MessageBox.Show("请输入确认密码", "注册提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
                            }
                        }
                        else if (PassBox.Text == RePassBox.Text)
                        {
                            MessageBox.Show("新密码不能与原始密码相同", "注册提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
                        }
                    }
                    else if (RePassBox.Text == "")
                    {
                        MessageBox.Show("请输入新密码", "注册提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
                    }
                }
                else if (PassBox.Text == "")
                {
                    MessageBox.Show("请输入原始密码", "注册提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
                }
            }
            else if (IdBox.Text == "")
            {
                MessageBox.Show("请输入账号", "注册提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
            }
        }
        //界面图片更改
        private void IdBox_TextChanged(object sender, EventArgs e)
        {
            this.pictureBox2.Image = Properties.Resources.bili2;
        }

        private void PassBox_TextChanged(object sender, EventArgs e)
        {
            this.pictureBox2.Image = Properties.Resources.bili4;
        }

        private void RePassBox_TextChanged(object sender, EventArgs e)
        {
            this.pictureBox2.Image = Properties.Resources.bili4;
        }

        private void RePassBox1_TextChanged(object sender, EventArgs e)
        {
            this.pictureBox2.Image = Properties.Resources.bili4;
        }
        //加载事件
        private void changecode_Load(object sender, EventArgs e)
        {
            IdBox.Focus();
        }
    }
}
